package dev.pda.display.presentation.page

import dev.pda.display.presentation.common.base.BaseViewModel
import dev.pda.display.presentation.page.model.PageData
import dev.pda.display.presentation.page.model.WidgetData
import dev.pda.display.presentation.page.model.WidgetModel

class PageViewModel : BaseViewModel() {

    var widgetData: WidgetData<PageData<WidgetModel<Any>>>? = null
    override fun init() {

    }

    fun getProgramWidth(): Int {
        return widgetData?.programWidth?.toInt() ?: 0
    }

    fun getProgramHeight(): Int {
        return widgetData?.programHeight?.toInt() ?: 0
    }

    fun getViewWidth(viewWidth: Double?): Int {
        return (viewWidth?.let { getProgramWidth().times(it) })?.toInt() ?: 0
    }

    fun getViewHeight(viewHeight: Double?): Int {
        return (viewHeight?.let { getProgramHeight().times(it) })?.toInt() ?: 0
    }

}